package jianzhiOffer;

import java.util.HashSet;
import java.util.Set;

public class num61 {
    public boolean isStraight(int[] nums) {
        Set<Integer> set = new HashSet<>();
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        for(int num : nums) {
            if(num == 0) continue;
            max = Math.max(max,num);
            min = Math.min(min,num);
            if(!set.add(num)) return false;
            set.add(num);
        }
        return max - min < 5 ? true : false;
    }
}
